package ps.app.ode.connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class ConnectionFactory {

	private static Connection con;

	public static Connection getOracleJDBCConnection() {

		try {
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		} catch (java.lang.ClassNotFoundException e) {
			System.err.print("ClassNotFoundException: ");
			System.err.println(e.getMessage());
		}

		try {
			ResourceBundle resource = ResourceBundle.getBundle("ps.app.ode.connection.config");
			String password = resource.getString("pass");
			String url = resource.getString("url");
			String userId = resource.getString("userId");

			con = DriverManager.getConnection(url, userId, password);
		} catch (SQLException ex) {
			System.err.println("SQLException: " + ex.getMessage());
		}

		return con;
	}

}
